/*
 * chip_atmel.h
 *
 * Created: 2022/7/22 星期五 17:03:40
 *  Author: sk602
 */ 

#ifndef __ATMEL__API__
#define __ATMEL__API__

#include "chip_select_def.h"
#include "chip_common_hal_def.h"
#include <avr/io.h>
#include <util/delay.h>
#include <avr/sfr_defs.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
//#include <avr/>

#if (1==USE_ATMEL)

//#define F_CPU 16000000UL

#define SWD_Disable() 

#define HAL_TouchInit() 

#define HAL_TouchGetValue() 5


#define Sleep(x) _delay_ms(x)

u32 CntSysTick;

void HAL_GPIO_Config(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin, uint16_t ModelSel);
void HAL_GPIO_WritePin(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
bool HAL_GPIO_ReadPin(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin);
void HAL_GPIO_TogglePin(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin);



#if 0

bool HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);



void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);

void HAL_TimerInit(unsigned char WhichTimer, u16 Period, unsigned char Psc, u8 Prio);

//以下函数需要根据C51来进行变更，目前没有统一接口
#define GetAdc()                          \
{                                     \
	ll_adc_start_enable();            \
	while (!(LL_ADC_DONE_PEND_GET())) \
	;                             \
	LL_ADC_DONE_PEND_CLR();           \
}

void EFlashInit(void);

void LVDInit(void);
#endif

#endif
#endif
